package com.ls.modules.sys.biz.manager;

import com.ls.base.baseClass.backStage.BaseService;
import com.ls.common.baseClass.BackStageService;
import com.ls.modules.sys.dal.mongodb.dao.PersonRepository;
import com.ls.modules.sys.dal.mongodb.entity.PersonEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author: xiaosu
 * @date: 2018-09-20  22:09
 */

@Service
public class TestMongoService   extends BackStageService {

    @Autowired
    private PersonRepository personRepository;

    @Transactional(rollbackFor =Exception.class)
    public void insertEntity() {

        PersonEntity entity=new PersonEntity();

        entity.setName("xiaosu");
        entity.setAge(20);
        entity.setGender(true);



        personRepository.save(entity);
       logger.info("保存成功！");
    }


}
